home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Just Call Me Internet
/
Just Call Me Internet.iso
/
prog
/
atari
/
m2
/
cat3src
/
cat
/
maustaus.i
< prev
next >
Wrap
Text File
|
1997-10-26
|
18KB
|
558 lines
IMPLEMENTATION MODULE MausTauschrsc;
FROM SYSTEM IMPORT ADR, ADDRESS, BYTE, TSIZE;
FROM Storage IMPORT ALLOCATE;
IMPORT mtAppl, mtUtils, mtXobjects;
IMPORT MagicAES;
IMPORT MagicVDI;
IMPORT MagicDOS;
IMPORT MagicStrings;
IMPORT MagicTypes;
IMPORT MagicSys;
IMPORT mtRsc;
IMPORT CatGlobal;
CONST catrsc = 'cat.rsc';
midrsc = 'catmid.rsc';
colrsc = 'catcol.rsc';
VAR Tree : ARRAY[0..nrTrees-1] OF ADDRESS;
valid: ARRAY [0..256] OF CHAR;
tmplt: ARRAY [0..256] OF CHAR;
CONST newRoutine = TRUE;
VAR theRSC : mtRsc.RESOURCE;
PROCEDURE vdiFix(VAR pfd : MagicVDI.MFDB; theAddr : ADDRESS; wb, h : INTEGER); FORWARD;
PROCEDURE vdiTrans(sAddr : ADDRESS; swb : INTEGER;
dAddr : ADDRESS; dwb, h, handle : INTEGER);
VAR src, dst : MagicVDI.MFDB;
BEGIN
vdiFix(src, sAddr, swb, h); (* Load the source MFDB *)
src.fdStand := 1; (* Standard-Format *)
vdiFix(dst, dAddr, dwb, h); (* Load the destination MFDB *)
dst.fdStand := 0; (* Clear the std flag *)
MagicVDI.TransformForm(handle, src, dst);
END vdiTrans;
TYPE ptrBITBLK = POINTER TO MagicAES.BITBLK;
PROCEDURE transBitblk(spec : ptrBITBLK; handle : INTEGER);
VAR tAddr : ADDRESS;
wb, hl: INTEGER;
BEGIN
tAddr := spec;
IF tAddr = ADDRESS(LONG(-1)) THEN RETURN END;
wb := spec^.biWb; (* Extract image dimensions *)
hl := spec^.biHl; (* Perform a transform in place *)
vdiTrans(tAddr, wb, tAddr, wb, hl, handle);
END transBitblk;
PROCEDURE MaskImg (adr: ADDRESS; byteLen, height: CARDINAL);
TYPE ByteSet = SET OF [0..7];
VAR ptr: POINTER TO ARRAY [0..$FFFF] OF BYTE;
i, j, k : CARDINAL;
step : CARDINAL;
BEGIN
IF adr = ADDRESS(-1L) THEN RETURN END;
IF adr = ADDRESS(0L) THEN RETURN END;
ptr := adr;
FOR i := 0 TO height - 1 DO
(* Zeilenweise durchgehen *)
FOR k := 0 TO byteLen - 1 DO
IF i MOD 2 = 0
THEN
ptr^[i*byteLen + k] := BYTE(ByteSet(ptr^[i*byteLen + k]) * ByteSet($55));
ELSE
ptr^[i*byteLen + k] := BYTE(ByteSet(ptr^[i*byteLen + k]) * ByteSet($AA));
END;
END;
END;
END MaskImg;
PROCEDURE MaskImage (tr: ADDRESS; ob: INTEGER);
VAR
tree : POINTER TO ARRAY[0..200] OF MagicAES.OBJECT;
image : MagicAES.PtrBITBLK;
BEGIN
tree := tr;
(* image := tree^[ob].obSpec.ImagePtr; *)
image := mtXobjects.GetObSpec (tree, ob);
MaskImg (image^.biData, image^.biWb, image^.biHl);
END MaskImage;
PROCEDURE FixData (adr: ADDRESS; byteLen, height, targetHeight: CARDINAL);
TYPE ByteSet = SET OF [0..7];
VAR ptr: POINTER TO ARRAY [0..$FFFF] OF BYTE;
i, j, k : CARDINAL;
step : CARDINAL;
BEGIN
IF targetHeight >= height THEN RETURN END;
IF adr = ADDRESS(-1L) THEN RETURN END;
IF adr = ADDRESS(0L) THEN RETURN END;
step := (targetHeight DIV (height - targetHeight));
j := 0;
ptr := adr;
FOR i := 0 TO targetHeight - 1 DO
(* Zeilenweise durchgehen *)
FOR k := 0 TO byteLen - 1 DO
ptr^[i*byteLen + k] := ptr^[j*byteLen + k];
END;
INC (j);
IF (j MOD step) = 0
THEN
(* Zeile verodern und nochmal j erhhen *)
FOR k := 0 TO byteLen - 1 DO
ptr^[i*byteLen + k] := BYTE(ByteSet(ptr^[i*byteLen + k]) + ByteSet(ptr^[j*byteLen + k]));
(*
ptr^[i*byteLen + k] := ptr^[j*byteLen + k];
*)
END;
INC (j);
END;
END;
END FixData;
PROCEDURE FixImage (tr: ADDRESS; ob: INTEGER);
VAR
tree : POINTER TO ARRAY[0..200] OF MagicAES.OBJECT;
image : MagicAES.PtrBITBLK;
BEGIN
tree := tr;
(* image := tree^[ob].obSpec.ImagePtr; *)
image := mtXobjects.GetObSpec (tree, ob);
FixData (image^.biData, image^.biWb, image^.biHl, tree^[ob].obHeight);
image^.biHl := tree^[ob].obHeight;
tree^[ob].obWidth := image^.biWb * 8;
END FixImage;
PROCEDURE FixIcon (tr: ADDRESS; ob: INTEGER);
VAR
tree : POINTER TO ARRAY[0..200] OF MagicAES.OBJECT;
image : MagicAES.PtrICONBLK;
wb : INTEGER;
BEGIN
tree := tr;
(* image := tree^[ob].obSpec.IconPtr; *)
image := mtXobjects.GetObSpec (tree, ob);
wb := (image^.ibWicon + 7) DIV 8;
FixData (image^.ibPmask, wb, image^.ibHicon, tree^[ob].obHeight);
FixData (image^.ibPdata, wb, image^.ibHicon, tree^[ob].obHeight);
IF image^.ibHicon > tree^[ob].obHeight
THEN
(* Positionen des Textes und Zeichens fixen *)
wb := (tree^[ob].obHeight DIV (image^.ibHicon- tree^[ob].obHeight)) + 1;
DEC (image^.ibYchar, image^.ibYchar DIV wb);
DEC (image^.ibYtext, image^.ibYtext DIV wb);
END;
(* Gre fixen *)
image^.ibHicon := tree^[ob].obHeight;
tree^[ob].obWidth := image^.ibWicon;
END FixIcon;
PROCEDURE TransGImage(tr : ADDRESS; obj, handle : INTEGER; fixSize: BOOLEAN);
VAR type, wb, hl : INTEGER;
tAddr : ADDRESS;
spec : ptrBITBLK;
ptrIcn : MagicAES.PtrICONBLK;
tree : POINTER TO ARRAY[0..200] OF MagicAES.OBJECT;
BEGIN
tree := tr;
(* type := tree^[obj].obType; *)
(* spec := ADDRESS(tree^[obj].obSpec.ImagePtr); *)
type := mtXobjects.GetObtype (tree, obj);
spec := mtXobjects.GetObSpec (tree, obj);
fixSize := fixSize & ~ mtUtils.InFlag (tree, obj, 13);
IF ADDRESS(spec) = ADDRESS(LONG(-1)) THEN RETURN END;
IF (type MOD 255) = MagicAES.GIMAGE
THEN
transBitblk(spec, handle);
IF (mtAppl.CharHeight >= 8) & (mtAppl.CharHeight < 16) & fixSize
THEN
FixImage (tr, obj);
END;
ELSIF (type MOD 255) = MagicAES.GICON
THEN
ptrIcn := ADDRESS(spec);
hl := ptrIcn^.ibHicon;
wb := (ptrIcn^.ibWicon + 7) DIV 8;
tAddr := ptrIcn^.ibPdata;
IF tAddr # ADDRESS(-1L)
THEN
vdiTrans (tAddr, wb, tAddr, wb, hl, handle)
END;
tAddr := ptrIcn^.ibPmask;
IF tAddr # ADDRESS(-1L)
THEN
vdiTrans (tAddr, wb, tAddr, wb, hl, handle)
END;
IF (mtAppl.CharHeight >= 8) & (mtAppl.CharHeight < 16) & fixSize
THEN
FixIcon (tr, obj);
END;
END;
END TransGImage;
(*
nrTrees = 15;
VAR TreeAddr: POINTER TO ARRAY [0..nrTrees-1] OF ADDRESS;
*)
(* MagiC XTED Struktur. Gehrt nach MagicAES.D *)
TYPE XTED = RECORD
xtePtmplt : POINTER TO ARRAY [0..255] OF CHAR;
xtePvalid : POINTER TO ARRAY [0..255] OF CHAR;
xteVislen : INTEGER;
xteScroll : INTEGER;
END;
PROCEDURE InstallLongEdit(tree: mtUtils.tObjcTree; obj: CARDINAL; length: INTEGER);
VAR tedPtr: MagicAES.PtrTEDINFO;
adr : ADDRESS;
validChar : CHAR;
i : INTEGER;
xted : POINTER TO XTED;
BEGIN
tedPtr := mtXobjects.GetObSpec (tree, obj);
ALLOCATE (adr, length+2);
IF adr = NIL
THEN
RETURN
END;
WITH tedPtr^ DO
validChar := tePvalid^[0];
IF validChar = 0C
THEN
validChar := 'X';
END;
FOR i := 0 TO length-1 DO
valid[i] := validChar;
tmplt[i] := '_';
END;
valid[length] := '';
tmplt[length] := '';
(* MagiC-Scroller *)
IF CatGlobal.magIx & (CatGlobal.magIxDate >= $19950829L)
THEN
(* Jawohl, wir scrollen ber MagiC *)
teJust := MagicVDI.LeftJust;
ALLOCATE (xted, TSIZE(XTED));
IF xted = NIL
THEN
RETURN;
END;
xted^.xtePtmplt := ADR(tmplt);
xted^.xtePvalid := ADR(valid);
xted^.xteVislen := teTmplen - 1;
xted^.xteScroll := 0;
tePtmplt := NIL;
tePvalid := ADDRESS(xted);
ELSE
teFontid := 0;
tePvalid := ADR(valid);
tePtmplt := ADR(tmplt);
END;
teTxtlen := length;
teTmplen := length;
tePtext := adr;
END;
END InstallLongEdit;
PROCEDURE RscInit():BOOLEAN;
CONST cImgCount = 36;
TYPE tImgInfo = RECORD
trIdx,
obIdx : INTEGER;
fixSize : BOOLEAN;
END;
tImgArray = ARRAY [0..cImgCount-1] OF tImgInfo;
CONST cImgTable = tImgArray{
tImgInfo{about, thecat0, FALSE},
tImgInfo{about, thecat1, FALSE},
tImgInfo{about, thecat2, FALSE},
tImgInfo{about, thecat4, FALSE},
tImgInfo{gruppen, grcfull, TRUE},
tImgInfo{gruppen, grcempty, TRUE},
tImgInfo{grsteuer, wupmess, TRUE},
tImgInfo{grsteuer, whupmess, TRUE},
tImgInfo{grsteuer, wdownmess, TRUE},
tImgInfo{grsteuer, whdownmess, TRUE},
tImgInfo{grsteuer, wrightmess, TRUE},
tImgInfo{grsteuer, whrightmess, TRUE},
tImgInfo{grsteuer, wleftmess, TRUE},
tImgInfo{grsteuer, whleftmess, TRUE},
tImgInfo{grsteuer, return, TRUE},
tImgInfo{grsteuer, hreturn, TRUE},
tImgInfo{grsteuer, waction, TRUE},
tImgInfo{grsteuer, winfo, TRUE},
tImgInfo{grsteuer, wtree, TRUE},
tImgInfo{grsteuer, wlist, TRUE},
tImgInfo{grsteuer, wpict, TRUE},
tImgInfo{grsteuer, wpop, TRUE},
tImgInfo{msgctrl, ctrledit, FALSE},
tImgInfo{msgctrl, ctrlkomm, FALSE},
tImgInfo{msgctrl, ctrlview, FALSE},
tImgInfo{msgctrl, ctrldel, FALSE},
tImgInfo{msgctrl, ctrlcopy, FALSE},
tImgInfo{msgctrl, ctrlhdr, FALSE},
tImgInfo{msgctrl, ctrlback, FALSE},
tImgInfo{editctrl, ec_back, FALSE},
tImgInfo{editctrl, ec_edit, FALSE},
tImgInfo{editctrl, ec_pop, FALSE},
tImgInfo{cat_icon, the_icon, FALSE},
tImgInfo{loadbox, loadimg0, TRUE},
tImgInfo{loadbox, loadimg1, TRUE},
tImgInfo{loadbox, loadimg2, TRUE}
};
VAR workIn : MagicVDI.tWorkIn;
workOut : MagicVDI.tWorkOut;
vdiHandle, j : INTEGER;
scrap : ARRAY[0..255] OF CHAR;
rsrcname : ARRAY[0..255] OF CHAR;
normalResource: BOOLEAN;
o1,o2,o3,o4: INTEGER;
(*$? newRoutine:
rsPtr : mtRsc.RSXHDR;
*)
(*$? NOT newRoutine:
rsPtr : POINTER TO MagicTypes.RSHDR;
*)
base : mtUtils.tObjcTree;
typ : INTEGER;
extyp : INTEGER;
c : CARDINAL;
imgInfo : tImgInfo;
BEGIN
(* Je nach Auflsung, AES und Farbanzahl Resource auswhlen *)
normalResource := FALSE;
(*
IF mtAppl.CharHeight = 8
THEN
(* St-Mid Ressource laden *)
MagicStrings.Assign (midrsc, rsrcname);
ELS
*)
IF (mtAppl.Bitplanes >= 4) &
( newRoutine OR
(MagicAES.AESGlobal.apVersion >= $399 ))
THEN
(* ApplGetinfo aufrufen, ob Farbicons untersttzt werden *)
IF newRoutine
THEN
(* Farbresource mit Farbicons laden *)
MagicStrings.Assign (colrsc, rsrcname);
ELSIF ( (CatGlobal.magIx & (CatGlobal.magIxVer >= $200))
OR ~CatGlobal.magIx)
& (MagicAES.ApplGetinfo (MagicAES.AECOLOR, o1, o2, o3, o4) = 1)
& (o3 = 1)
THEN
(* Farbresource mit Farbicons laden *)
MagicStrings.Assign (colrsc, rsrcname);
ELSE
normalResource := TRUE;
MagicStrings.Assign (catrsc, rsrcname);
END;
ELSE
(* normale Resource laden *)
normalResource := TRUE;
MagicStrings.Assign (catrsc, rsrcname);
END;
(*$? NOT newRoutine:
IF ~MagicAES.RsrcLoad (rsrcname) THEN
CatGlobal.ApplPath(scrap);
MagicStrings.Append(rsrcname, scrap);
IF ~MagicAES.RsrcLoad (scrap) THEN
IF ~normalResource
THEN
(* Nochmal versuchen mit normaler Resource *)
MagicStrings.Assign (catrsc, rsrcname);
IF ~MagicAES.RsrcLoad (rsrcname) THEN
CatGlobal.ApplPath(scrap);
MagicStrings.Append(rsrcname, scrap);
IF ~MagicAES.RsrcLoad (scrap) THEN
RETURN FALSE
END;
END;
ELSE
RETURN FALSE
END;
END;
END;
WITH MagicAES.AESPB.cbPglobal^ DO
rsPtr := apPmem;
WITH rsPtr^ DO
(* Objcspec relozieren *)
IF rshNobs > 0 THEN
base:= rsPtr + MagicSys.CastToAddr (rshObject);
FOR c:= 0 TO rshNobs - 1 DO
WITH base^[c] DO
typ:= obType MOD 255;
extyp:= obType DIV 255;
IF (extyp = 24)
THEN
InstallLongEdit (base, c, 256);
END; (* IF *)
END; (* WITH *)
END; (* FOR *)
END; (* IF rshNobs *)
END;
END;
*)
(*$? newRoutine:
IF ~mtRsc.LoadRsc (rsrcname, theRSC) THEN
CatGlobal.ApplPath(scrap);
MagicStrings.Append(rsrcname, scrap);
IF ~mtRsc.LoadRsc (rsrcname, theRSC) THEN
IF ~normalResource
THEN
(* Nochmal versuchen mit normaler Resource *)
MagicStrings.Assign (catrsc, rsrcname);
IF ~mtRsc.LoadRsc (rsrcname, theRSC) THEN
CatGlobal.ApplPath(scrap);
MagicStrings.Append(rsrcname, scrap);
IF ~mtRsc.LoadRsc (scrap, theRSC) THEN
RETURN FALSE
END;
END;
ELSE
RETURN FALSE
END;
END;
END;
mtRsc.GetRscHeader (theRSC, rsPtr);
WITH rsPtr DO
IF rshNobs > 0
THEN
base := mtRsc.GaddrRsc (theRSC, MagicAES.ROBJECT, 0);
FOR c:= 0 TO SHORT(rshNobs) - 1 DO
WITH base^[c] DO
typ:= obType MOD 255;
extyp:= obType DIV 255;
IF (extyp = 24)
THEN
InstallLongEdit (base, c, 256);
END; (* IF *)
END; (* WITH *)
END; (* FOR *)
END (* IF rshNobs *)
END;
*)
(*$? NOT newRoutine:
FOR c := 0 TO rsPtr^.rshNtree-1 DO
Tree[c] := MagicAES.RsrcGaddr (MagicAES.RTREE, c);
END;
*)
(*$? newRoutine:
FOR c := 0 TO SHORT(rsPtr.rshNtree)-1 DO
Tree[c] := mtRsc.GaddrRsc (theRSC, MagicAES.RTREE, c);
END;
*)
TreeAddr := ADR(Tree);
workIn[0] := 1; (* Bildschirmtreiber, aktuelle Auflsung *)
workIn[1] := 1; (* Linientyp durchgehend *)
workIn[2] := 0; (* Linienfarbe *)
workIn[3] := 0; (* Markertyp *)
workIn[4] := 0; (* Markerfarbe *)
workIn[5] := 1; (* Textstil - System *)
workIn[6] := 1; (* Textfarbe *)
workIn[7] := 1; (* Flltyp wei *)
workIn[8] := 1; (* Fllmusterindex *)
workIn[9] := 0; (* Fllfarbe *)
workIn[10]:= 2; (* Gertespezifische Koordinaten *)
MagicAES.GrafHandle(vdiHandle, j,j,j,j);
MagicVDI.OpenVirtual(workIn, vdiHandle, workOut);
IF vdiHandle > 0 THEN
FOR j := 0 TO cImgCount-1 DO
imgInfo := cImgTable[j];
WITH imgInfo DO
TransGImage (Tree[trIdx], obIdx, vdiHandle, fixSize);
END;
END;
IF (mtAppl.Bitplanes = 1)
THEN
MaskImage (Tree[about], thecat0);
MaskImage (Tree[loadbox], loadimg2);
END;
(*
TransGImage(Tree[about], thecat0, vdiHandle, FALSE);
TransGImage(Tree[about], thecat1, vdiHandle, FALSE);
TransGImage(Tree[gruppen], grcfull, vdiHandle, TRUE);
TransGImage(Tree[gruppen], grcempty, vdiHandle, TRUE);
TransGImage(Tree[grsteuer], wupmess, vdiHandle, TRUE);
TransGImage(Tree[grsteuer], whupmess, vdiHandle, TRUE);
TransGImage(Tree[grsteuer], wdownmess, vdiHandle, TRUE);
TransGImage(Tree[grsteuer], whdownmess, vdiHandle, TRUE);
TransGImage(Tree[grsteuer], wrightmess, vdiHandle, TRUE);
TransGImage(Tree[grsteuer], whrightmess, vdiHandle, TRUE);
TransGImage(Tree[grsteuer], wleftmess, vdiHandle, TRUE);
TransGImage(Tree[grsteuer], whleftmess, vdiHandle, TRUE);
TransGImage(Tree[grsteuer], return, vdiHandle, TRUE);
TransGImage(Tree[grsteuer], hreturn, vdiHandle, TRUE);
TransGImage(Tree[grsteuer], waction, vdiHandle, TRUE);
TransGImage(Tree[grsteuer], winfo, vdiHandle, TRUE);
TransGImage(Tree[grsteuer], wtree, vdiHandle, TRUE);
TransGImage(Tree[grsteuer], wpop, vdiHandle, TRUE);
TransGImage(Tree[msgctrl], ctrledit, vdiHandle, TRUE);
TransGImage(Tree[msgctrl], ctrlkomm, vdiHandle, TRUE);
TransGImage(Tree[msgctrl], ctrlview, vdiHandle, TRUE);
TransGImage(Tree[msgctrl], ctrldel, vdiHandle, TRUE);
TransGImage(Tree[msgctrl], ctrlcopy, vdiHandle, TRUE);
TransGImage(Tree[msgctrl], ctrlhdr, vdiHandle, TRUE);
TransGImage(Tree[msgctrl], ctrlback, vdiHandle, TRUE);
TransGImage(Tree[editctrl], ec_back, vdiHandle, TRUE);
TransGImage(Tree[editctrl], ec_edit, vdiHandle, TRUE);
TransGImage(Tree[editctrl], ec_pop, vdiHandle, TRUE);
TransGImage(Tree[cat_icon], the_icon, vdiHandle, TRUE);
TransGImage(Tree[loadbox], loadimg0, vdiHandle, TRUE);
TransGImage(Tree[loadbox], loadimg1, vdiHandle, TRUE);
*)
MagicVDI.CloseVirtual(vdiHandle);
END;
RETURN TRUE
END RscInit;
PROCEDURE RscFree ();
BEGIN
mtRsc.FreeAll();
END RscFree;
PROCEDURE vdiFix(VAR pfd : MagicVDI.MFDB; theAddr : ADDRESS; wb, h : INTEGER);
BEGIN
WITH pfd DO
fdWdwidth := wb DIV 2;
fdW := wb * 8;
fdH := h;
fdNplanes := 1;
fdAddr := theAddr;
END
END vdiFix;
END MausTauschrsc.